package com.yxhl.zoume.core.tripsmgmt.ui;

import android.content.Context;

import com.amap.api.maps.AMap;
import com.amap.api.maps.model.BitmapDescriptorFactory;
import com.amap.api.maps.model.MarkerOptions;
import com.amap.api.services.core.LatLonPoint;
import com.amap.api.services.route.DrivePath;
import com.yxhl.zoume.R;
import com.yxhl.zoume.core.func.map.overlay.DrivingRouteOverlay;
import com.yxhl.zoume.utils.ZMMapUtils;

/**
 * Created by sugarya on 16/5/27.
 */
public class CustomDrivingRouteOverlay extends DrivingRouteOverlay {

    private LatLonPoint mStartPoint;
    private LatLonPoint mTargetPoint;

    public CustomDrivingRouteOverlay(
            Context context,
            AMap aMap,
            DrivePath drivePath,
            LatLonPoint latLonPoint,
            LatLonPoint latLonPoint1,
            LatLonPoint startPoint,
            LatLonPoint targetPoint
    ) {
        super(context, aMap, drivePath, latLonPoint, latLonPoint1,null);
        mStartPoint = startPoint;
        mTargetPoint = targetPoint;
    }

    @Override
    protected void addStartAndEndMarker() {
        MarkerOptions startMarkerOptions = new MarkerOptions();
        startMarkerOptions
                .anchor(0.5f, 0.8f)
                .position(ZMMapUtils.convertToLatLng(mStartPoint))
                .icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_qidian));
        MarkerOptions targetMarkerOptions = new MarkerOptions();
        targetMarkerOptions
                .anchor(0.5f, 0.8f)
                .position(ZMMapUtils.convertToLatLng(mTargetPoint))
                .icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_zhongdian));

        this.startMarker = this.mAMap.addMarker(startMarkerOptions);
        this.endMarker = this.mAMap.addMarker(targetMarkerOptions);
    }
}
